import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_09_game/base/refresh/base_refresh.dart';
import 'package:flutter_09_game/config/app_color.dart';
import 'package:flutter_09_game/generated/assets.dart';
import 'package:flutter_09_game/generated/locales.g.dart';
import 'package:flutter_09_game/pages/game/game_detail/game_detail_logic.dart';
import 'package:flutter_09_game/pages/game/game_detail/game_detail_transfer/game_detail_transfer_logic.dart';
import 'package:flutter_09_game/utils/utils_other.dart';
import 'package:flutter_09_game/widgets/image/auto_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class WidgetBetAddress extends StatelessWidget {
  const WidgetBetAddress(
      {super.key, required this.logic, required this.gameLogic});

  final GameDetailTransferLogic logic;
  final GameDetailLogic gameLogic;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SizedBox(
          height: 28.w,
          child: Row(
            children: [
              Text(
                LocaleKeys.betAddress.tr,
                style: TextStyle(
                    color: AppColor.textPrimary.withOpacity(0.94),
                    fontSize: 14.sp,
                    fontWeight: FontWeight.w600),
              ),
              const Spacer(),
              GestureDetector(
                onTap: () {
                  logic.showScanQr();
                },
                child: Row(
                  children: [
                    AutoImage(
                      Assets.gameDetailScan,
                      width: 16.w,
                    ),
                    Text(
                      LocaleKeys.scanBet.tr,
                      style: TextStyle(
                        color: AppColor.textPrimary.withOpacity(0.7),
                        fontSize: 14.sp,
                      ),
                    ).marginSymmetric(horizontal: 4.w),
                    AutoImage(
                      Assets.gameArrowRight,
                      width: 16.w,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
        4.verticalSpaceFromWidth,
        Container(
          padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w)
              .copyWith(right: 6.w),
          decoration: BoxDecoration(
            color: Colors.black.withOpacity(0.3),
            borderRadius: BorderRadius.circular(8.w),
          ),
          child: Row(
            children: [
              Expanded(child: Obx(() {
                return Text(
                  gameLogic.getReceiveAddress(),
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(
                    color: AppColor.textPrimary.withOpacity(0.94),
                    fontSize: 14.sp,
                    // fontWeight: FontWeight.w600
                  ),
                );
              })),
              8.horizontalSpace,
              GestureDetector(
                onTap: () {
                  UtilsOther.copyMemberId(gameLogic.getReceiveAddress());
                },
                child: AutoImage(
                  Assets.gameCopy,
                  width: 32.w,
                ),
              )
            ],
          ),
        )
      ],
    );
  }
}
